package com.cindata

class LogService
{
    def  error(def rootName,def batchId,def info){
        String pathStr =  System.properties['user.dir']+"\\src\\main\\webapp\\images\\errors\\"
        String filePath = batchId+".log"
        File path = new File(pathStr)
        File file = new File(pathStr+filePath)
        FileOutputStream fos = null
        if(!path.exists()){
            path.mkdirs()
        }
        if(!file.exists()){
            file.createNewFile()
            fos = new FileOutputStream(file)
        }else{
            fos = new FileOutputStream(file,true)
        }
        OutputStreamWriter osw = new OutputStreamWriter(fos, "GBK")
        osw.write(info+"\r\n")
        osw.close()
    }
}
